package com.example.weatherforecast.weatherdatatool;
import com.example.weatherforecast.R;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author：coderChen
 * @Package：com.example.weatherforecast.weathertool
 * @Project：WeatherForecast
 * @Date：2024/1/1 16:56
 * @Filename：WeatherInfo
 */
public class CurrentWeatherInfo {
    private String cityName;
    private String temperature;
    private String lowestTemperature;
    private String highestTemperature;
    private String weatherType;
    private String airQuality;
    private String updateTime;
    private String notice;
    private List<RecentWeatherInfo> forecasts;
    private static final Map<String, Integer> background = new HashMap<>();

    // 构造函数
    public CurrentWeatherInfo(String cityName, String temperature, String lowestTemperature, String highestTemperature, String weatherType, String airQuality, List<RecentWeatherInfo> forecasts, String updateTime, String notice) {
        this.cityName = cityName;
        this.temperature = temperature;
        this.lowestTemperature = lowestTemperature;
        this.highestTemperature = highestTemperature;
        this.weatherType = weatherType;
        this.airQuality = airQuality;
        this.forecasts = forecasts;
        this.updateTime = updateTime;
        this.notice = notice;
    }
    static {
//        background.put("晴", R.mipmap.sunny);
//        background.put("多云", R.mipmap.cloudy);
        background.put("小雨", R.mipmap.rain11);
        background.put("中雨", R.mipmap.rain11);
        background.put("大雨", R.mipmap.rain11);
        background.put("雷阵雨", R.mipmap.rain11);
        background.put("晴", R.mipmap.suntian);
        background.put("多云", R.mipmap.duoyun);
        background.put("阴", R.mipmap.wu);
        background.put("雾", R.mipmap.wu);
    }


    // getter 和 setter 方法
    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getNotice(){
        return notice;
    }
//    public String setNotice( String notice){
//        this.notice=notice;
//        return notice;
//    }

    public String getTemperature() {
        return temperature;
    }

    public void setTemperature(String temperature) {
        this.temperature = temperature;
    }
    public String getUpdateTime() {
        return updateTime;
    }
    public String setUpdateTime(String updateTime){
        return updateTime;
    }

    public String getLowestTemperature() {
        return lowestTemperature;
    }

    public void setLowestTemperature(String lowestTemperature) {
        this.lowestTemperature = lowestTemperature;
    }

    public String getHighestTemperature() {
        return highestTemperature;
    }

    public void setHighestTemperature(String highestTemperature) {
        this.highestTemperature = highestTemperature;
    }

    public String getWeatherType() {
        return weatherType;
    }

    public void setWeatherType(String weatherType) {
        this.weatherType = weatherType;
    }

    public String getAirQuality() {
        return airQuality;
    }

    public void setAirQuality(String airQuality) {
        this.airQuality = airQuality;
    }
    public List<RecentWeatherInfo> getForecasts() {
        return forecasts;
    }


    public void setForecasts(List<RecentWeatherInfo> forecasts) {
        this.forecasts = forecasts;
    }
    public  int getWeatherTypeBackground() {
        // 根据天气类型获取对应的图片资源，如果未找到对应的图片资源，默认返回一个默认图片资源
        return background.getOrDefault(weatherType, R.mipmap.background1);
    }
}



